Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

icss-utils

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icss-utils

ICSS utils for postcss ast

  • 5.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
increased by6.34%
Maintainers
4
Weekly downloads
 
Created

What is icss-utils?

The icss-utils package provides utilities for working with ICSS (Interoperable CSS), which is a convention for handling CSS modules. It allows for the extraction and manipulation of CSS module content, such as importing/exporting variables and handling scoped CSS.

What are icss-utils's main functionalities?

Extracting ICSS imports and exports

This feature allows you to extract ICSS imports and exports from a CSS string. The `extractICSS` function returns an object with `icssImports` and `icssExports` properties, which contain the extracted values.

const { extractICSS } = require('icss-utils');
const css = ':export { color: red; }';
const { icssImports, icssExports } = extractICSS(css);

Replacing values in CSS

This feature enables you to replace symbols in a CSS string with specified values. The `replaceSymbols` function takes a CSS string and an object of replacements, then returns the CSS with the values replaced.

const { replaceSymbols } = require('icss-utils');
const css = '.className { color: colorValue; }';
const replacements = { colorValue: 'red' };
const result = replaceSymbols(css, replacements);

Creating an ICSS replacement map

This feature helps in creating a map of ICSS replacements from exports. The `createICSSReplacements` function takes an object of ICSS exports and returns an object that can be used for replacing symbols in CSS.

const { createICSSReplacements } = require('icss-utils');
const icssExports = { color: 'red' };
const replacements = createICSSReplacements(icssExports);

Other packages similar to icss-utils

Keywords

FAQs

Package last updated on 19 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc